﻿@page "/_Feedback/Suggestion/Create"
@using WBBvNext.ViewModel._Feedback.SuggestionVMs;
@inherits BasePage

<ValidateForm @ref="vform" Model="@Model" OnValidSubmit="@Submit">
	<Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.FormRow">

		<BootstrapInput @bind-Value="@Model.Entity.Title" />
		<Row ColSpan="2">
			<Textarea @bind-Value="@Model.Entity.Detail" rows="4" />
		</Row>
		<Select @bind-Value="@Model.Entity.QuestionType" PlaceHolder="@WtmBlazor.Localizer["Sys.PleaseSelect"]" />
		<BootstrapInput @bind-Value="@Model.Entity.UserName" />
		<BootstrapInput @bind-Value="@Model.Entity.Email" />
		<Switch @bind-Value="@Model.Entity.IsSolved" />
		<Row ColSpan="2">
			<Textarea @bind-Value="@Model.Entity.Remark" rows="4" />
		</Row>
	</Row>
	<div class="modal-footer table-modal-footer">
		<Button Color="Color.Primary" Icon="fa fa-save" Text="@WtmBlazor.Localizer["Sys.Close"]" OnClick="OnClose" />
		<Button Color="Color.Primary" ButtonType="ButtonType.Submit" Icon="fa fa-save" Text="@WtmBlazor.Localizer["Sys.Create"]" IsAsync="true" />
	</div>
</ValidateForm>

@code {

	private SuggestionVM Model = new SuggestionVM();
	private ValidateForm vform { get; set; }


	protected override async Task OnInitializedAsync()
	{

		await base.OnInitializedAsync();
	}


	private async Task Submit(EditContext context)
	{
		await PostsForm(vform, "/api/Suggestion/add", (s) => "Sys.OprationSuccess");
	}

	public void OnClose()
	{
		CloseDialog();
	}

}
